Bug 272465 - Semantic analyzer fails if headers are included within namespaces
Summary: Semantic analyzer fails if headers are included within namespaces
Status: RESOLVED DUPLICATE of bug 217180
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (old) (show other bugs)
Version: 4.2.1
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: 4.2.0
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-04 19:04 UTC by Sandro Mani
Modified: 2011-05-05 16:52 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 Sandro Mani 2011-05-04 19:04:14 UTC
Version:           4.2.1 (using KDE 4.6.2) 
OS:                Linux

If you include a header within a namespace, the semantic analyzer will still think the included functions/classes/variables are visible at global namespace scope. If you write mynamespace::myIncludedWhatever, the semantic analyzer will not find the function/class/variable.

Reproducible: Always

Steps to Reproduce:
-------------- someheader.h --------------
namespace test {
#include "someheader.h"
}

int main(int argc, char **argv) {
	test::A a;
	a.foo();
	test::A::bar();
    return 0;
}

-------------- main.cpp --------------

namespace test {
#include "someheader.h"
}

int main(int argc, char **argv) {
	test::A a;
	a.foo();
	test::A::bar();
    return 0;
}

Actual Results:  
Pressing ctrl+space on a.foo() will not give any syntax completion hints, test::A::bar() will get underlined with the semantic analyzer reporting that the declaration was not found.

Expected Results:  
Should work

OS: Linux (x86_64) release 2.6.38.4-20.fc15.x86_64
Compiler: gcc

kdevplatform-libs-1.2.2-1.fc15.x86_64
kdevplatform-1.2.2-1.fc15.x86_64
kdevelop-4.2.2-1.fc15.x86_64
kdevelop-libs-4.2.2-1.fc15.x86_64


The situation where I encounter this situation a lot is with the Eigen linear algebra library.
Comment 1 Sandro Mani 2011-05-04 19:05:34 UTC
... Copy paste error,

-------------- someheader.h --------------
#ifndef __SOMEHEADER_H__
#define __SOMEHEADER_H__

#include <iostream>

class A {
public:
	void foo(){ std::cout<<"foo\n"; }
	static void bar(){ std::cout<<"bar\n"; }
};

#endif
Comment 2 Aleix Pol 2011-05-05 16:52:53 UTC

*** This bug has been marked as a duplicate of bug 217180 ***