Bug 321104 - C++11: missing support for inline namespaces
Summary: C++11: missing support for inline namespaces
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (old) (show other bugs)
Version: 4.5.1
Platform: Arch Linux Linux
: NOR minor
Target Milestone: 4.3.0
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-13 11:00 UTC by meyerm
Modified: 2013-10-20 16:36 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description meyerm 2013-06-13 11:00:43 UTC
I recently updated KDevelop to 4.5.1 and gcc to 4.8.1. After that KDevelop complains in the Problems tab that the aforementioned class is not found. This didn't happen with KDevelop 4.5.0 and gcc 4.8.0 (unfortunately I updated both at the same time, so I cannot say which change lead to the problem).

The example code in the "Additional Information" text field below shows the problem.

Reproducible: Always

Steps to Reproduce:
1. include chrono
2. use std::chrono::steady_clock
3. switch to the problem reporting tab
Actual Results:  
Semantic Analysis: Declaration not found: std::chrono::steady_clock::now

Expected Results:  
<nothing in the problem tab>

#include <chrono>

int
main( int argc, char *argv[] )
{
	auto time{ std::chrono::steady_clock::now() };

	return 0;
}
Comment 1 Milian Wolff 2013-10-20 14:03:16 UTC
The issue is due to missing support for inline namespaces:

namespace a {
    inline namespace b {
        struct foo {
            static int bar() { return 0; }
        };
    }
}

int main()
{
    return a::foo::bar();
}

This compiles fine but shows the same issue as std::chrono. Note that most of std::chrono from GCC is wrapped in an inline namespace _V2.
Comment 2 Milian Wolff 2013-10-20 15:10:25 UTC
Git commit b6412bb844e23679ced188b923816c9b31677eb8 by Milian Wolff.
Committed on 20/10/2013 at 15:08.
Pushed by mwolff into branch 'master'.

C++11: Add implicit using directive for inline namespaces.

This fixes association of uses etc. to contents in inline namespaces,
which is the case for e.g. most of the stuff in std::chrono.

Note: Code completion of items in an inline namespace nested in
another namespace (such as is the case for stuff in std::chrono::_V2)
does not show up properly yet.

M  +14   -1    languages/cpp/cppduchain/declarationbuilder.cpp
M  +1    -0    languages/cpp/cppduchain/tests/test_duchain.h
M  +21   -0    languages/cpp/cppduchain/tests/test_duchain_cpp2011.cpp

http://commits.kde.org/kdevelop/b6412bb844e23679ced188b923816c9b31677eb8
Comment 3 Milian Wolff 2013-10-20 16:36:21 UTC
Git commit 83aee7320a201f44f1d94a1dec02338d5869ac1a by Milian Wolff.
Committed on 20/10/2013 at 16:35.
Pushed by mwolff into branch 'master'.

Also take namespace imports into account for code completion after ::

This should solve quite a few other related code completion issues.
Note that this code was there already for the "global" code completion,
but as soon as you picked a namespace from the list, you'd loose all
imported items.

M  +42   -27   languages/cpp/codecompletion/context.cpp
M  +4    -0    languages/cpp/codecompletion/context.h
M  +10   -0    languages/cpp/tests/test_cppcodecompletion.cpp
M  +1    -0    languages/cpp/tests/test_cppcodecompletion.h

http://commits.kde.org/kdevelop/83aee7320a201f44f1d94a1dec02338d5869ac1a